package com.example.rbac5.demo.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.rbac5.demo.entity.UserRole;
import com.example.rbac5.demo.mapper.UserRoleMapper;
import com.example.rbac5.demo.service.UserRoleService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wuyunbin
 * @since 2023-11-08
 */
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {

    @Override
    public String findRoleIdByUserId(String userId) {
        LambdaQueryWrapper<UserRole> wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(UserRole::getUserId,userId);
        UserRole userRole=this.getOne(wrapper);
        return userRole.getRoleId();
    }
}
